﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using KPIS.GERP.Models.ICM;
using KPIS.GERP.Models.SYS;
using KPIS.GERP.WEB.GIMS.MasLookUpService;

namespace KPIS.GERP.WEB.GIMS.Classes
{
	public static class LookupUtility
	{
		public static string GetLookupNameFromSelectList(IEnumerable<SelectListItem> selectList, object lookupId)
		{
			foreach(SelectListItem s in selectList)
			{
				if(CompareUtility.IsObjectToStringEqual(lookupId, s.Value))
					return s.Text;
			}
			return string.Empty;
		}

		public static string GetLookupNameFromAllLookup(object lookupId)
		{
			using (var lus = new MasLookUpServiceClient())
			{
                //var allLookup = lus.GetLookupNameFromAllLookup(new MasLookUp { RecordStatus = RecordStatus.UsedStatus });
                //foreach (MasLookUp lu in allLookup)
                //{
                //    if (CompareUtility.IsObjectToStringEqual(lookupId, lu.LookUpId))
                //        return lu.LookUpName;
                //}
				return string.Empty;
			}
		}
	}
}